package keke;

import java.io.*;
import java.util.*;

public class TextFileTest2{
   public static List<Student44> readStudents(String fileName) throws IOException{
	   List<Student44> students=new ArrayList<Student44>();
	   BufferedReader br = null;
		try {
			FileInputStream fis = new FileInputStream("student.txt");
			InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
			br = new BufferedReader(isr);
			String line = null;
			while((line=br.readLine())!=null){
				String[] tokens = line.split("\\|");
				String name = tokens[0];
				String sex = tokens[1];
				int year = Integer.parseInt(tokens[2]);
				int month = Integer.parseInt(tokens[3]);
				int day = Integer.parseInt(tokens[4]);
				students.add(new Student44(name,sex,year,month,day));
			}
			for(Student44 e:students){
				System.out.println(e);
			}
		} finally{
			if (br!=null){
				br.close();
			}
		}
		return students;
   }
}
